package Demo02.Demo06;
/**
 * 生产者消费者模式
 *
 * */
public class Demo_MainClass {
    public static void main(String[] args) {
        // 只实例化一个KFC对象，保证每一个服务员和用户在同一个KFC对象内
        Demo_KFC kfc = new Demo_KFC();
        //实例化4个客户对象
        Demo_Customer customer1 = new Demo_Customer(kfc);
        Demo_Customer customer2 = new Demo_Customer(kfc);
        Demo_Customer customer3 = new Demo_Customer(kfc);
        Demo_Customer customer4 = new Demo_Customer(kfc);

        //实例化3个服务员对象
        Demo_Waiter waiter1 = new Demo_Waiter(kfc);
        Demo_Waiter waiter2 = new Demo_Waiter(kfc);
        Demo_Waiter waiter3 = new Demo_Waiter(kfc);
        //让所有的对象的线程都开始工作
        waiter1.start();
        waiter2.start();
        waiter3.start();

        customer1.start();
        customer2.start();
        customer3.start();
        customer4.start();


    }
}
